﻿CREATE PROCEDURE [dbo].[GetEvent]
AS
BEGIN
 -- SET NOCOUNT ON added to prevent extra result sets from
 -- interfering with SELECT statements.
 SET NOCOUNT ON;

    -- Insert statements for procedure here
SELECT a.EventId
      ,a.Name
      ,a.Venue
      ,a.StartDateTime
      ,a.EndDateTime
      ,a.Details
      ,a.CreateDate
      ,a.UpdateDate
,max(d.SmallUrl) as PropertyURL
  FROM Mobile_Event a 
  left join AW_Picture d on d.PropertyId = a.EventId
where a.StatusDelete=null or a.StatusDelete=0
group by
a.EventId
      ,a.Name
      ,a.Venue
      ,a.StartDateTime
      ,a.EndDateTime
      ,a.Details
      ,a.CreateDate
      ,a.UpdateDate
  order by a.UpdateDate desc
END
